1 package jrre.gui;
2
3 import jrre.JRRE;
4 import java.awt.*;
5 import javax.swing.*;
6 import javax.swing.tree.*;
7 import java.awt.event.*;
8
9 public class NativeMethodAreaGui extends JFrame {
10
11 private JTree methodAreaTree = new JTree();
12 private DefaultMutableTreeNode treeRoot;
13 private DefaultTreeModel treeModel;
14 int classCount = 0;
15
16 public NativeMethodAreaGui(){
17
18 super("Native Method Area");
19
20 // Set up and add tree.
21 treeRoot = new DefaultMutableTreeNode("Native Method Area");
22 treeModel = new DefaultTreeModel(treeRoot);
23
24 methodAreaTree = new JTree(treeModel);
25
26 JPanel treePanel = new JPanel();
27 treePanel.add(methodAreaTree);
28
29 JScrollPane scrollPane = new JScrollPane(methodAreaTree);
30 //scrollPane.add(methodAreaTree);
31 Container content = getContentPane();
32 content.add(scrollPane);
33
34 addWindowListener(new WindowDestroyer());
35
36 setSize(300,400);
37 setLocation(700, 300);
38
39 if(JRRE.guiOn())
40 setVisible(true);
41 }
42
43 public void clear(){
44
45 classCount = 0;
46 treeRoot.removeAllChildren();
47 //frameRoot = treeRoot;
48 }
49
50 public void addClass(String className){
51
52 treeRoot.setUserObject("Native Method Area: "+(classCount++));
53 DefaultMutableTreeNode classToAdd = new DefaultMutableTreeNode(className);
54 treeRoot.add(classToAdd);
55 treeModel.reload();
56
57 TreePath path = new TreePath(classToAdd.getPath());
58 methodAreaTree.expandPath(path);
59 }
60
61 public void removeClass(String className){
62
63 }
64
65 class WindowDestroyer extends WindowAdapter{
66 public void windowClosing(WindowEvent e){
67 System.exit(0);
68 }
69 }
70
71 }
72
This page was automatically generated by Maven